package com.byzk.p2p.admin.base.util;

import java.util.List;

/**
 * 分页封装类
 */

public class PageInfo<T> {
	private List<T> pageList; // 当前页的记录集合
	private int total;        //总记录数
	private int index;	  //当前页数
	private int limit;     //每页显示多少条记录
	private int pages;        //总共多少页
	private int start;        //开始记录数
	private int end;	      //结束记录数
	private int min;          //开始页数
	private int max;          //结束页数
	private String condition;

	private Double sum;       //查询结果金额sum值
	private Double sumComplete ;//已还款金额sum值
	public Double getSumComplete() {
		return sumComplete;
	}

	public void setSumComplete(Double sumComplete) {
		this.sumComplete = sumComplete;
	}

	private Double sumFee;    //查询结果利息sum值
	private Double sumBlance; //查询剩余金额sum值
	
	public PageInfo(){
		
	}
	
	public PageInfo(int total, int index){
		init(total, index,limit);
	}
	
	public PageInfo(int total, int index,int limit){
		 init(total, index, limit);
	}
	
	private void init(int total, int index, int limit){
        //设置基本参数
        this.total=total;
        this.limit=limit;
        this.pages=(this.total-1)/this.limit+1;
        this.start=(index-1)*limit+1;
        this.end=index*limit;
        if(index<1){
            this.index=1;
        }else if(index>this.pages){
            this.index=this.pages;
        }else{
            this.index=index;
        }

        if(pages-index>=9){
        	this.min=index;
        	this.max=index+9;
        }else if(pages<9){
        	this.min=1;
        	this.max=pages;
        }else{
        	this.min=pages-9<1?1:pages-9;
        	this.max=pages;
        }
	 }
	
	public int getTotal() {
		return total;
	}

	public void setTotal(int total) {
		this.total = total;
	}

	public List<T> getPageList() {
		return pageList;
	}

	public void setPageList(List<T> pageList) {
		this.pageList = pageList;
	}

	public int getIndex() {
		return index;
	}
	public void setIndex(int index) {
		this.index = index;
	}
	public int getLimit() {
		return limit;
	}
	public void setLimit(int limit) {
		this.limit = limit;
	}
	public int getPages() {
		return pages;
	}
	public void setPages(int pages) {
		this.pages = pages;
	}
	public String getCondition() {
		return condition;
	}

	public void setCondition(String condition) {
		this.condition = condition;
	}

	public int getStart() {
		return start;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public int getEnd() {
		return end;
	}

	public void setEnd(int end) {
		this.end = end;
	}

	public int getMin() {
		return min;
	}

	public void setMin(int min) {
		this.min = min;
	}

	public int getMax() {
		return max;
	}

	public void setMax(int max) {
		this.max = max;
	}

	public Double getSum() {
		return sum;
	}

	public void setSum(Double sum) {
		this.sum = sum;
	}

	public Double getSumFee() {
		return sumFee;
	}

	public void setSumFee(Double sumFee) {
		this.sumFee = sumFee;
	}

	public Double getSumBlance() {
		return sumBlance;
	}

	public void setSumBlance(Double sumBlance) {
		this.sumBlance = sumBlance;
	}
}
